/*
 * @Date: 2022-03-25 13:11:14
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-03-25 13:19:51
 * @FilePath: \vue3Components\src\hooks\useCopy.ts
 * @Description: 复制操作
 */
import { ElMessage } from "element-plus";
export const useCopy = (text: string) => {
  const input = document.createElement("input");
  document.body.appendChild(input);
  input.value = text;
  input.select();
  document.execCommand("copy");
  document.body.removeChild(input);
  ElMessage({
    type: "success",
    message: "图标复制成功!",
  });
};
